#include "point.h"
#include "circle.h"
#include <cmath>

void Point :: setX(int x) {
    m_X = x;
}
int Point :: getX() {
    return m_X;
}

//设置和获取Y
void Point :: setY(int y) {
    m_Y = y;
}
int Point :: getY() {
    return m_Y;
}

//设置和获取半径
void Circle :: setR(int r) {
    m_R = r;
}
int Circle :: getR() {
    return m_R;
}

//设置和获取圆心
void Circle :: setCenter(Point center) {
    m_Center = center;
}
Point Circle :: getCenter() {
    return m_Center;
}

//判断点和圆的关系
void is_inCircle(Circle & c , Point & p) {
    int ret = pow(p.getX() - c.getCenter().getX() , 2)
            + pow(p.getY() - c.getCenter().getY() , 2);
    int r = pow(c.getR() , 2);
    if (ret == r) {
        cout << "点在圆上" << endl;
    }
    else if (ret > r) {
        cout << "点在圆外" << endl;
    }
    else {
        cout << "点在圆内" << endl;
    }
}

int main() {
    //创建圆心点
    Point center;
    center.setX(10);
    center.setY(0);
    //创建圆
    Circle c;
    c.setR(10);
    c.setCenter(center);

    //创建一点
    Point p;
    p.setX(10);
    p.setY(10);

    //判断点和圆的关系
    is_inCircle(c , p);

    return 0;
}